package com.publiccms.entities.system;

//Generated 2015-6-25 11:28:56 by Hibernate Tools 4.3.1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import org.springframework.format.annotation.DateTimeFormat;

import com.sanluan.common.source.entity.MyColumn;

/**
 * SystemUser generated by hbm2java
 */
@Entity
@Table(name = "system_user", uniqueConstraints = { @UniqueConstraint(columnNames = "auth_token"),
		@UniqueConstraint(columnNames = "name"), @UniqueConstraint(columnNames = "nick_name")})
public class SystemUser implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	@MyColumn(title = "用户名", condition = true, like = true, or = true, name = "name")
	private String name;
	@MyColumn(title = "密码")
	private String password;
	@MyColumn(title = "用户昵称", condition = true, like = true, or = true, name = "name")
	private String nickName;
	@MyColumn(title = "部门", condition = true)
	private Integer deptId;
	@MyColumn(title = "角色")
	private String roles;
	@MyColumn(title = "邮箱", condition = true, like = true, or = true, name = "name")
	private String email;
	@MyColumn(title = "已验证邮箱", condition = true)
	private boolean emailChecked;
	@MyColumn(title = "是否管理员", condition = true)
	private boolean superuserAccess;
	@MyColumn(title = "已禁用", condition = true)
	private boolean disabled;
	private String authToken;
	@MyColumn(title = "上次登录日期", condition = true, order = true)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date lastLoginDate;
	@MyColumn(title = "上次登录IP")
	private String lastLoginIp;
	@MyColumn(title = "登录次数", order = true)
	private int loginCount;
	@MyColumn(title = "注册日期", condition = true, order = true)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date dateRegistered;

	public SystemUser() {
	}

	public SystemUser(String name, String password, String nickName, boolean emailChecked, boolean superuserAccess,
			boolean disabled, int loginCount) {
		this.name = name;
		this.password = password;
		this.nickName = nickName;
		this.emailChecked = emailChecked;
		this.superuserAccess = superuserAccess;
		this.disabled = disabled;
		this.loginCount = loginCount;
	}

	public SystemUser(String name, String password, String nickName, Integer deptId, String roles, String email,
			boolean emailChecked, boolean superuserAccess, boolean disabled, String authToken, Date lastLoginDate,
			String lastLoginIp, int loginCount, Date dateRegistered) {
		this.name = name;
		this.password = password;
		this.nickName = nickName;
		this.deptId = deptId;
		this.roles = roles;
		this.email = email;
		this.emailChecked = emailChecked;
		this.superuserAccess = superuserAccess;
		this.disabled = disabled;
		this.authToken = authToken;
		this.lastLoginDate = lastLoginDate;
		this.lastLoginIp = lastLoginIp;
		this.loginCount = loginCount;
		this.dateRegistered = dateRegistered;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", unique = true, nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "password", nullable = false, length = 32)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "nick_name", unique = true, nullable = false, length = 45)
	public String getNickName() {
		return this.nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	@Column(name = "dept_id")
	public Integer getDeptId() {
		return this.deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	@Column(name = "roles", length = 65535)
	public String getRoles() {
		return this.roles;
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}

	@Column(name = "email", length = 100)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "email_checked", nullable = false)
	public boolean isEmailChecked() {
		return this.emailChecked;
	}

	public void setEmailChecked(boolean emailChecked) {
		this.emailChecked = emailChecked;
	}

	@Column(name = "superuser_access", nullable = false)
	public boolean isSuperuserAccess() {
		return this.superuserAccess;
	}

	public void setSuperuserAccess(boolean superuserAccess) {
		this.superuserAccess = superuserAccess;
	}

	@Column(name = "disabled", nullable = false)
	public boolean isDisabled() {
		return this.disabled;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	@Column(name = "auth_token", unique = true, length = 40)
	public String getAuthToken() {
		return this.authToken;
	}

	public void setAuthToken(String authToken) {
		this.authToken = authToken;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_login_date", length = 19)
	public Date getLastLoginDate() {
		return this.lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	@Column(name = "last_login_ip", length = 20)
	public String getLastLoginIp() {
		return this.lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	@Column(name = "login_count", nullable = false)
	public int getLoginCount() {
		return this.loginCount;
	}

	public void setLoginCount(int loginCount) {
		this.loginCount = loginCount;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date_registered", length = 19)
	public Date getDateRegistered() {
		return this.dateRegistered;
	}

	public void setDateRegistered(Date dateRegistered) {
		this.dateRegistered = dateRegistered;
	}

}
